import { reactive, onMounted, onUnmounted } from 'vue';

export default function () {
  let point = reactive({
    x: 0,
    y: 0
  });

  function getPoint(e) {
    point.x = e.clientX;
    point.y = e.clientY;
  }

  onMounted(() => {
    window.addEventListener('click', getPoint);
  });

  onUnmounted(() => {
    window.removeEventListener('click', getPoint);
  });

  return point;
}
